# -*- coding: utf-8 -*-
# !/usr/bin/env python
"""
-------------------------------------------------
   File Name：     experiment
   Description :   
   Author :       lth
   date：          2022/10/15
-------------------------------------------------
   Change Activity:
                   2022/10/15 14:56: create this script
-------------------------------------------------
"""
__author__ = 'lth'

from PIL import Image
import torch
from torchvision import transforms

from utils import extract

# img = Image.open("218.jpg").convert("RGB")
# img = img.resize((128, 128))
#
# T=transforms.Compose([
#     transforms.ToTensor(),
#     transforms.Normalize((0.5,0.5,0.5),(0.5,0.5,0.5))
# ])
# img = T(img).unsqueeze(0)
#
# noise = torch.randn_like(img)
#
# betas = torch.linspace(1e-4, 0.02, 1000).double()
# alpha = 1 - betas
# alpha_bar = torch.cumprod(alpha, dim=0)
#
# sqrt_alpha_bar = torch.sqrt(alpha_bar)
# sqrt_one_minus_alpha_bar = torch.sqrt(1 - alpha_bar)
# t = torch.randint(1000, size=(img.shape[0],))
#
# img_coef = extract(sqrt_alpha_bar, t, img.shape)
# noise_coef = extract(sqrt_one_minus_alpha_bar, t, img.shape)
#
# x_t = img_coef * img +noise_coef * noise
#
# print(x_t.shape)
#
from train import Train

model = Train()
model.inference()
